package com.topfinance.cnaps2.web.sys;

import java.util.HashMap;
import java.util.List;

import com.topfinance.cnaps2.ebo.SysParamCtrlEbo;
import com.topfinance.cnaps2.service.IParamCtrlManager;
import com.topfinance.frame.web.BaseSupport;
import com.opensymphony.xwork2.ModelDriven;

/**
 * <p>
 * Description:
 * </p>
 * 
 * @author
 * @version 1.50
 *          <p>
 *          Copyright: Copyright (c) 2004 2005
 *          </p>
 *          <p>
 *          Company:
 *          </p>
 */
public final class ParamCtrlAction extends BaseSupport implements ModelDriven<SysParamCtrlEbo> {

	private IParamCtrlManager ctrlManager = null;

	private SysParamCtrlEbo transEbo = new SysParamCtrlEbo();

	public SysParamCtrlEbo getModel() {
		return transEbo;
	}

	public void setCtrlManager(IParamCtrlManager ctrlManager) {
		this.ctrlManager = ctrlManager;
	}

	public ParamCtrlAction() {
		super();
	}

	public String execute() {
		return list();
	}

	public String list() {
		log.debug("ParamCtrlAction-list begin");
		try {
			String paramCatgs = request.getParameter("type");
			String code = request.getParameter("code");
			List l = ctrlManager.getAllParamList(paramCatgs,code);
			rtnResultMap = new HashMap();
			rtnResultMap.put(DATA_LIST_ROOT, l);
			rtnResultMap.put(RECORDS_COUNT, l.size());
		} catch (Exception e) {
			handleException(e);
		}
		log.debug("ParamCtrlAction-list end");
		return SUCCESS;
	}

}
